import { useDispatch, useSelector } from "react-redux";

export default function Hello() {
  const count = useSelector((state: any) => state.count);
  const dispatch: any = useDispatch();
  return (
    <div>
      <h4>Hello</h4>
      <p>count: {count}</p>
      <button onClick={() => dispatch({ type: "inc" })}>Add</button>

      <button
        onClick={() => {
          dispatch((a: any) => {
            setTimeout(() => {
              a({ type: "inc" });
            }, 1000);
          });
        }}
      >
        Add-2
      </button>
    </div>
  );
}
